<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML>
<html>
<head>
<title>My JSP 'orderpage.jsp' starting page</title>
<link rel="stylesheet" type="text/css" href="css/docs.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />


<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/bootstrap-alert.js"></script>
<script type="text/javascript" src="js/bootstrap-dropdown.js"></script>
<script type="text/javascript" src="js/bootstrap-modal.js"></script>
<script type="text/javascript" src="js/bootstrap-scrollspy.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.22.custom.min.js"></script>

<script type="text/javascript" src="DatePicker/WdatePicker.js"></script>

<link href="assets/ico/bioroad-logo.ico" rel="shortcut icon">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">


<style type="text/css">
#orderpage {
	position: absolute;
	top: 0px;
	width: 700px;
	margin-left: 360px;
}

.the-icons {
	list-style: none outside none;
}

.icon-trash {
	cursor: pointer;
}

#tab {
	display: none;
}

#myTabContent {
	display: none;
}

</style>
</head>
<body style="padding-top:0px;">
	<div id="orderpage">
		<hr />
		<img alt="" src="img/baolude-logo.gif">
		<hr /><i class="icon-home"></i>
		<a class="tohomePage" href="togetHomePageOfDisease.action">回主页</a>》》》
		<i class="icon-list"></i>
		<a href="javascript:history.go(-1);">导出的疾病列表</a>》》》<i class="icon-edit"></i><span>填写订单</span>

		<h2 style="font-family: 方正静蕾简体;">填写订单的详细信息</h2>
		<form action="saveSampleInfo.action">
			<div>
				患者姓名:<input id="patientName" class="span2" type="text"
					name="patient.name" onblur="getValues()" /> <input class="span2"
					type="hidden" name="patient.sn" /> 出生日期:<input
					style="width:130px; " id="datepicker" class="hasDatepicker"
					type="text" onclick="WdatePicker()" name="patient.birthday"
					onblur="verifyDate()" /> 性别:<input type="radio" id="genderM"
					name="patient.gender" value="男" checked="checked" /> 男 <input
					type="radio" id="genderW" name="patient.gender" value="女" /> 女<br />
				编号:<input class="span2" type="text" name="patient.idNumber" /> 联系人:<input
					class="span2" type="text" name="patient.contact" /> 电话:<input id="ptel"
					class="span2" type="text" name="patient.telephone"
					onblur="verifyTel()" /> &nbsp;&nbsp;&nbsp;&nbsp; <br />
				测试项目:→→→→→→→→→→→ <a style="cursor: pointer;" id="gotoAddtestItem">去添加新的测试项目</a>
				<div class="row show-grid" style="padding-right:20%;">
					<ul>
						<c:forEach var="testItem" items="${testItemsList}">
							<div class="testItem">
								<input type="hidden" class="testItemSn" value="${testItem.sn }" />
								${testItem.name} &nbsp;&nbsp;&nbsp; ￥：${testItem.price}&nbsp;元 <i
									class="icon-trash" id="delTestItem${testItem.sn}"></i>
							</div>
						</c:forEach>
					</ul>
					<input type="hidden" name="tiList" value="${testItemList }" /> <input
						type="hidden" name="testItemList" />
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span>总计￥${totalcount}元
						<input type="hidden" name="sampleInfo.price" value="${totalcount}" />
					</span>
				</div>
				<div>
					生成样本类型:<input class="span2" type="text"
						name="sampleInfo.sampleType" /> 血样类型:<input class="span2"
						type="text" name="sampleInfo.bloodType" />
					<%--
				源序号:<input class="span2" type="text" name="sampleInfo." /> 
				编码:<input class="span2" type="text" name="sampleInfo." />
				编号:<input class="span2" type="text" name="sampleInfo." />--%>
				</div>
				<div></div>
			</div>
		</form>
		<a class="btn btn-success" id="createOrder" type="button"
			><i class="icon-check icon-white"></i>&nbsp;&nbsp;&nbsp;生成订单</a>

		<%--<a href="content/toinsert.action">xxxx</a>
	--%>
	</div>
	<%------------------------------------------弹框的隐藏域 --------------------------------------------%>
	
	<%----------------------------------------------------------------------------------- --%>
</body>
<script type="text/javascript">
	$(function() {
		$("#gotoAddtestItem")
				.click(
						function() {
							//alert($("#diseaseSn").text());
							var str = "";
							$(".testItemSn").each(function() {
								str = str + $(this).val() + "_";
							});
							//alert(str);

							var diseaseSn = $("#diseaseSn").text();
							window.location.href = "goAddTestitem.action?selectTestItems="
									+ str + "&diseaseSn=" + diseaseSn;
						});
	});

	$(function() {
		$(".testItem").each(function() {
			var testItemSn = $(this).children("input").val();
			$("#delTestItem" + testItemSn).click(function() {
				$(this).parent().css({
					display : "none"
				});
			});
		});
	});

	$(function() {
		$("#createOrder").click(function() {
			//alert($("input[name='patient']").val());
			var str = "";
			$(".testItemSn").each(function(i, obj) {
				alert($(this).parent().css("display"));
				if ($(this).parent().css("display") == "block") {
					str = str + ($(this).val() + "_");//只是testItem的sn值，添加疾病对应的选中testItem需添加相应的disease的sn值

				}

			});
			alert(str);
			$("input[name='testItemList']").val(str);

			if ($("input[name='patient.name']").val() == "") {

				return false;
			}

			$("form").submit();
			//alert("添加成功！！！");
		});

		$("#patientName").autocomplete({
			source : "getPatient.action",
			//[{label:"rose,QWQWE,0000010",value:"rose,QWQWE,2012-02-02,0000010"},{label:"jack,null,null",value:"jack,null,null,null"}],
			select : function(e, ui) {
				var vals = ui.item.value.split(",");
				$("input[name='patient.name']").val(vals[0]);
				if (vals[1] == "男") {
					$("#genderM").attr("checked", true);
				} else if (vals[1] == "女") {
					$("#genderW").attr("checked", true);
				}
				;
				$("input[name='patient.birthday']").val(vals[2]);
				$("input[name='patient.idNumber']").val(vals[3]);
				$("input[name='patient.contact']").val(vals[4]);
				$("input[name='patient.telephone']").val(vals[5]);
				$("input[name='patient.sn']").val(vals[6]);
				return false;
			}
		});
		$(".span3")._keyEvent = function() {
		};

		$("#patientName").blur(function() {
			if ($("input[name='patient.sn']").val() == "") {
				$('#myModal3').modal('show');
			}
		});
	});
	function getValues() {
	}

	function verifyTel() {

		var tel = $("input[name='patient.telephone']").val();

		var reg = /^(0?1[358]\d{9})$|^((0(10|2[1-3]|[3-9]\d{2})-)?[1-9]\d{6,7})$/;
		if (reg.test(tel)) {

		}
		//alert(reg.test(tel));

	}

	/*function verifyDate(){
		var str = $("input[name='patient.birthday']").val();
		alert(str);
		
		var reg = /^\d{2,4}-(0?[1-9]|1[0-2])-(0?[1-9]|[1-2][0-9]|3[0-1])$/;
		
		alert(reg.test(str));
		//alert("verify");
	}*/
</script>
</html>
